﻿@model Bk.Models.UserInfo
@{
    ViewBag.Title = "Register";
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Register</title>
    <script src="~/jQuery/jquery-3.4.1.min.js"></script>
    <script src="~/jQuery/jquery.unobtrusive-ajax.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />
    <style>
        body {
            background: #f5f6fa;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .register-card {
            background: #fff;
            border-radius: 16px;
            box-shadow: 0 4px 24px rgba(0,0,0,0.10);
            padding: 36px 32px 32px 32px;
            width: 400px;
            display: flex;
            flex-direction: column;
            align-items: stretch;
        }
        .register-title {
            font-size: 24px;
            font-weight: bold;
            text-align: center;
            margin-bottom: 6px;
        }
        .register-subtitle {
            font-size: 14px;
            color: #888;
            text-align: center;
            margin-bottom: 24px;
        }
        .input-label {
            font-size: 14px;
            color: #222;
            margin-bottom: 6px;
            margin-left: 2px;
        }
        .input-group {
            position: relative;
            margin-bottom: 20px;
        }
        .input-group input {
            width: 100%;
            padding: 12px 12px 12px 38px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            font-size: 15px;
            outline: none;
            background: #fafbfc;
            box-sizing: border-box;
            transition: border 0.2s;
        }
        .input-group input:focus {
            border: 1.5px solid #1976d2;
        }
        .input-group .fa {
            position: absolute;
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: #bbb;
            font-size: 16px;
            pointer-events: none;
        }
        .register-btn {
            width: 100%;
            background: #1976d2;
            color: #fff;
            border: none;
            border-radius: 8px;
            padding: 12px 0;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            margin-bottom: 16px;
            transition: background 0.2s;
        }
        .register-btn:hover {
            background: #1565c0;
        }
        .cancel-btn {
            width: 100%;
            background: #f5f5f5;
            color: #666;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 12px 0;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            margin-bottom: 16px;
            transition: background 0.2s;
        }
        .cancel-btn:hover {
            background: #eeeeee;
        }
        .login-link {
            text-align: center;
            font-size: 14px;
            color: #888;
        }
        .login-link a {
            color: #1976d2;
            text-decoration: none;
            margin-left: 4px;
        }
        .login-link a:hover {
            text-decoration: underline;
        }
        .validation-message {
            color: #e74c3c;
            font-size: 12px;
            margin-top: 4px;
            display: block;
        }
    </style>
</head>
<body>
    <div class="register-card">
        <div class="register-title">用户注册</div>
        <div class="register-subtitle">创建新账户，开始您的博客之旅</div>
        
        @using (Html.BeginForm("Register", "Default", FormMethod.Post, new { id = "regForm", name = "regForm" }))
        {
            @Html.AntiForgeryToken()
            
            <div class="input-label">手机号</div>
            <div class="input-group">
                <i class="fa fa-phone"></i>
                @Html.TextBoxFor(x => x.Phone, new { placeholder = "请输入手机号", autocomplete = "tel" })
                <span class="validation-message">@Html.ValidationMessage("Phone")</span>
            </div>
            
            <div class="input-label">用户名</div>
            <div class="input-group">
                <i class="fa fa-user"></i>
                @Html.TextBoxFor(x => x.UserName, new { placeholder = "请输入用户名", autocomplete = "username" })
                <span class="validation-message">@Html.ValidationMessage("UserName")</span>
            </div>
            
            <div class="input-label">密码</div>
            <div class="input-group">
                <i class="fa fa-lock"></i>
                @Html.PasswordFor(x => x.PassWord, new { placeholder = "请输入密码", autocomplete = "new-password" })
                <span class="validation-message">@Html.ValidationMessage("PassWord")</span>
            </div>
            
            <div class="input-label">确认密码</div>
            <div class="input-group">
                <i class="fa fa-lock"></i>
                @Html.PasswordFor(x => x.ConfirmPassword, new { placeholder = "请再次输入密码", autocomplete = "new-password" })
                <span class="validation-message">@Html.ValidationMessage("ConfirmPassword")</span>
            </div>
            
            <button type="submit" class="register-btn" onclick="checkUsrName()">注册</button>
            <button type="button" class="cancel-btn" onclick="clearForm()">取消</button>
        }
        
        <div class="login-link">
            已有账号？<a href="@Url.Action("Login", "Default")">立即登录</a>
        </div>
    </div>
<script>
    function clearForm() {
        $("#Phone").val('');
        $("#UserName").val('');
        $("#PassWord").val('');
        $("#ConfirmPassword").val('');
    }
    
    function checkUsrName() {
        // 这里可以添加用户名检查逻辑
        return true;
    }
</script>
</body>
</html>